from Crypto.Util.number import bytes_to_long
from secrets import k, P, flag

E = EllipticCurve(QQ,[0,2021,0,310,-2783])
assert P.xy()[1] == E.lift_x(2)
Q = k * P
R = Q + P

p = Q[0].numerator()
q = R[0].numerator()
e = 0x10001
n = p * q
assert k < n.bit_length()

m = bytes_to_long(flag)
c = pow(m, e, n)

print(f'n = {n}')
print(f'c = {c}')


#n = 2627832721798532654645633759787364870195582649392807630554510880534973280751482201937816738488273589173932960856611147584617677312265144131447658399933331448791094639659769069406481681017795446858858181106274806005669388289349727511470680972
#c = 96830301447792999743877932210925094490214669785432172099311147672020980136112114653571739648595225131425493319224428213036136642899189859618195566355934768513439007527385261977662612094503054618556883356183687422846428828606638722387070581